package cn.kent.abstractFactoryPattern;

/**
 * 主函数——女娲
 *
 * @author kent
 * @date 2021/5/11 18:16
 */
public class NvWa {
    public static void main(String[] args) {

        // 第一条生产线，生产女人
        HumanFactory femaleHumanFactory = new FemaleHumanFactory();
        Human blackFemale = femaleHumanFactory.createBlackHuman();
        blackFemale.cry();
        blackFemale.laugh();
        blackFemale.sex();
        blackFemale.talk();

        // 第二条生产线，生产男人
        HumanFactory maleHumanFactory = new MaleHumanFactory();
        Human yellowMaleHuman = maleHumanFactory.createYellowHuman();
        yellowMaleHuman.talk();
        yellowMaleHuman.cry();
        yellowMaleHuman.sex();
        yellowMaleHuman.laugh();

        /**
         * 优缺点：
         *      符合OCP原则，开闭原则，高内聚，低耦合。
         *
         * 加个双性人
         */
        HumanFactory doubleSexHumanFactory = new DoubleSexHumanFactory();
        Human doubleSexHuman = doubleSexHumanFactory.createBlackHuman();
        doubleSexHuman.sex();
        doubleSexHuman.laugh();
        doubleSexHuman.talk();
        doubleSexHuman.cry();
    }
}
